package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.common.vo.eduSchoolTj.EduSchoolTjSchoolVO;
import com.jwsoft.manager.common.vo.eduSchoolTj.EduSchoolTjVO;
import com.jwsoft.manager.common.vo.eduSchoolTj.StudentEnrollTjVO;
import com.jwsoft.manager.core.integration.EduSchoolTjParamsIntegration;
import com.jwsoft.manager.common.vo.eduSchoolTjParams.EduSchoolTjParamsVO;
import com.jwsoft.manager.common.vo.eduSchoolTjParams.EduSchoolTjParamsKeyVO;
import com.jwsoft.manager.common.vo.eduSchoolTjParams.EduSchoolTjParamsQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

import java.util.List;

/**
 * 学校调剂参数管理网关
 *
 * @author chenzh
 * @since 2023-07-04
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "学校调剂参数管理", description = "学校调剂参数管理")
public class EduSchoolTjParamsController {

    @Autowired
    public EduSchoolTjParamsIntegration eduSchoolTjParamsIntegration;

    @Operation(summary = "学校调剂参数管理分页查询", description = "学校调剂参数管理分页查询")
    @PostMapping(value = "/eduSchoolTjParams0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduSchoolTjParamsVO>> getList(@RequestBody @Validated EduSchoolTjParamsQueryVO vo) {
        return AppResponse.successData(eduSchoolTjParamsIntegration.getList(vo));
    }

    @Operation(summary = "学校调剂参数管理根据主键查询详情", description = "学校调剂参数管理根据主键查询详情")
    @PostMapping(value = "/eduSchoolTjParams0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSchoolTjParamsVO> getById(@RequestBody @Validated EduSchoolTjParamsKeyVO vo) {
        return AppResponse.successData(eduSchoolTjParamsIntegration.getById(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "学校调剂参数管理新增", description = "学校调剂参数管理新增")
    @PostMapping(value = "/eduSchoolTjParams0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSchoolTjParamsVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduSchoolTjParamsVO vo) {
        return AppResponse.successData(eduSchoolTjParamsIntegration.add(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "学校调剂参数管理修改", description = "学校调剂参数管理修改")
    @PostMapping(value = "/eduSchoolTjParams0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSchoolTjParamsVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduSchoolTjParamsVO vo) {
        return AppResponse.successData(eduSchoolTjParamsIntegration.edit(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "学校调剂参数管理删除", description = "学校调剂参数管理删除")
    @PostMapping(value = "/eduSchoolTjParams0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduSchoolTjParamsKeyVO vo) {
        eduSchoolTjParamsIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Operation(summary = "根据学校id查询可调剂学校", description = "根据学校id查询可调剂学校")
    @PostMapping(value = "/eduSchoolTjParams0007", produces = "application/json;charset=UTF-8")
    public AppResponse<List<EduSchoolTjParamsVO>> getListBySchoolId(@RequestBody @Validated EduSchoolTjParamsQueryVO vo) {
        return AppResponse.successData(eduSchoolTjParamsIntegration.getListBySchoolId(vo));
    }
    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "义务教育学校调剂保存", description = "义务教育学校调剂保存")
    @PostMapping(value = "/eduSchoolTjParams0008", produces = "application/json;charset=UTF-8")
    public AppResponse schoolTj(@RequestBody @Validated StudentEnrollTjVO vo) {
        eduSchoolTjParamsIntegration.schoolTj(vo);
        return AppResponse.success();
    }

}
